<?php

class Damages_Methods_Data_User_Edit extends Damages_Methods_Data_User {

  /**
   *
   * @var Damages_Methods_Data_DealerData_Simple[] 
   */
  public $dealers = array();

  public function __construct($user) {
    $this->id = $user->id;
    $this->email = $user->email;
    $this->firstName = $user->firstName;
    $this->lastName = $user->lastName;
    $this->phone = $user->phone;
    $this->phoneFax = $user->phoneFax;
    $this->phoneMobile = $user->phoneMobile;
    $this->position = $user->position;
    if ($user->dealers)
      foreach ($user->dealers->toArray() as $dealer) {
        $this->dealers[] = new Damages_Methods_Data_DealerData_Simple($dealer);
      }
    $this->permission = new Damages_Methods_Data_Permission_Edit($user->permission);
  }

}